"VHDL"作业

来源:百度知道 编辑:UC知道 时间:2024/05/31 04:18:04
我们选修的专业作业。真不知道自己当初为什么会选一个与自己专业毫不相关的课程。后悔死了...
望高手解答,题目请到如下网站浏览。http://hi.baidu.com/%D0%C5%E9%E4/blog/item/4e8566d797b04edba044df33.html谢谢
有什么不明白可以咨询QQ644937691
拜托各位帮我做一下啊

第一题
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt is
port(clk:in std_logic;
r,s,en:in std_logic;
a3,a2,a1,a0:in std_logic_vector(3 downto 0);
q3,q2,q1,q0:out std_logic_vector(3 downto 0));
end cnt;
architecture behav of cnt is
signal d3,d2,d1,d0:std_logic_vector(3 downto 0);
begin
process(r,s,en,clk)is
begin

if r='1' then
d3<="0000";d2<="0000";d1<="0000";d0<="0000";--清零
elsif s<='1' then
d3<=a3;d2<=a2;d1<=a1;d0<=a0;--预置值
elsif en='1' then
if clk'event and clk='1' then
if d0<="1001" then
d0<="0000";
if d1<="1001" then
d1<="0000";
if d2<="1001" then
d2<="0000";
if d3<="1001&